#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

INSTALL := install -o root -g root -m 755

CFLAGS:=$(shell dpkg-buildflags --get CFLAGS)
CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)

version=$(shell dpkg-parsechangelog | grep urgency | awk '{ print $$2; }'| \
sed -e s/"("// -e s/")"// | cut -d"-" -f1)

%:
	dh $@

override_dh_auto_build:
	dh_auto_build -- CFLAGS="$(CFLAGS) $(CPPFLAGS) -std=c99 -fomit-frame-pointer -pedantic -D_BSD_SOURCE \
	-DFWCUTTER_VERSION_=`echo $(version) | cut -d: -f2`"

override_dh_auto_clean:
	rm -f b43-fwcutter
	rm -rf $(CURDIR)/debian/b43-fwcutter/usr/man	

override_dh_installchangelogs:
	dh_installchangelogs $(CURDIR)/debian/b43-fwcutter.upstream-changelog

override_dh_auto_install:
	$(INSTALL) b43-fwcutter $(CURDIR)/debian/b43-fwcutter/usr/bin
